import request from '@/utils/request';

// 定义Other模块的数据类型
interface OtherDeptVO {
  deptId: number;
  deptName: string;
  parentId: number;
}

interface OtherUserVO {
  userId: number;
  userName: string;
  nickName: string;
  deptId: number;
  deptName?: string;
  email?: string;
  phonenumber?: string;
  avatar?: string;
}

// 获取部门树列表
export function deptTreeSelect() {
  return request({
    url: '/other/user/deptTree',
    method: 'get'
  });
}

// 根据部门ID获取用户列表
export function listUserByDeptId(deptId: string | number) {
  return request({
    url: `/other/user/list/${deptId}`,
    method: 'get'
  });
}

// 类型定义
export interface DeptTreeSelectResponse {
  code: number;
  data: OtherDeptVO[];
  msg: string;
}

export interface UserListResponse {
  code: number;
  data: OtherUserVO[];
  msg: string;
}

// 导出类型供其他组件使用
export type { OtherDeptVO, OtherUserVO };
